/**
 * Created by baiguiren on 1/25/17.
 */

let async = require('async');
let fs = require('fs');

// async.constant把一个常数转换为一个返回该常数的函数
async.waterfall([
  async.constant(42),
  function (value, next) {
    // value === 42
    console.log(value);
    next(null);
  }
], (err)=>{});

async.waterfall([
  async.constant(__dirname + '/test.txt', 'utf8'),
  fs.readFile,
  function (fileData, next) {
    console.log(fileData);
    next(null);
  }
], (err)=>{});

async.auto({
  hostname: async.constant('https://ide.baiguiren.com'),
  port: 3306,
  launchServer: ["hostname", "port", function (options, cb) {
    startServer(options, cb);
  }],
}, ()=>{});
